import React from "react"
import ReactDOM from "react-dom"
import {
    BrowserRouter as Router,
    Switch,
    Route,
    Redirect
} from 'react-router-dom'

import { Provider } from 'react-redux'
import App from "./App"
import { NotFound } from "./pages"
import "./index.less"
import zhCN from 'antd/lib/locale-provider/zh_CN'
import { LocaleProvider} from "antd"
import store from './store'


ReactDOM.render(
    //内层路由
    <Provider store={store}>
        <LocaleProvider locale={zhCN}>
            <Router>
                <Switch>
                    <Route
                        path="/admin"
                        component={App}
                    />
                    <Route
                        path="/404"
                        component={NotFound}
                    />
                    {/* 外层路由跳转admin及输入不正确跳转出错的情况 */}
                    <Redirect to="/admin" from="/" exact />
                    <Redirect to="/404" />
                </Switch>
            </Router>
        </LocaleProvider>
    </Provider>,
    document.getElementById('root')
);